/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.gov.cemaden.agent.proxy;

import br.gov.cemaden.library.dao.pcds.AquisicaoDao;
import br.gov.cemaden.library.interfaces.pcds.AquisicaoInterface;
import java.math.BigInteger;
import java.util.Date;
import org.hibernate.HibernateException;
import org.hibernate.Session;

/**
 *
 * @author alan
 */
public class AquisicaoProxy implements AquisicaoInterface{
    
    private AquisicaoInterface repository;
    
    public AquisicaoProxy(Session session){
        //this.setRepository(new AquisicaoDao(HibernateUtil.getSessionFactory().openSession()));
        this.setRepository(new AquisicaoDao(session));
    }
    
    private void setRepository(AquisicaoInterface repository){
        this.repository = repository;
    }

    public Long countByRede(Long idRede, Date datahora) {
        
        Long tmp = null;
        
        try{
            tmp = repository.countByRede(idRede, datahora);
        }
        catch(HibernateException ex){
            ex.printStackTrace();
        }
        
        return tmp;
    }
    
}
